-- die_kill_all
-- created by chendh
-- 死亡击杀所有怪物

return {
    apply = function(prop, baseValue)
        return baseValue + prop[3];
    end,

    -- 死亡触发
    trigger = function(who, prop, arg)
        if who.type ~= OBJECT_TYPE_MONSTER then
            return;
        end

        trace("die_kill_all", "kill all monsters");

        for pos = 1, GRID_SIZE do
            local grid = DungeonM.getGridByPos(pos);
            local monster = grid.monster;
            -- 击杀所有活着的怪物
            if grid:isOpened() and monster and not monster:isDead() then
                local hp = monster:getHp();
                monster:setRealHp(0);
                monster:die();

                -- 先初始化
                SkillM.initSequence(who, monster, 0);
                SkillM.getSequence(monster):die(who, monster, hp, 0);

            end
        end

        return true;
    end,

    record = function(target, prop, path)
        return false;
    end
};